Don't ignore the fact that gtk_file_system_get_parent() may return NULL.
authorMatthias Clasen <mclasen@redhat.com>
Wed, 2 May 2007 01:19:59 +0000 (01:19 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Wed, 2 May 2007 01:19:59 +0000 (01:19 +0000)
2007-05-01  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtkfilesystemmodel.c (_gtk_file_system_model_path_do):
        Don't ignore the fact that gtk_file_system_get_parent()
        may return NULL.  (#424042, Jan Martinek)

svn path=/trunk/; revision=17764

ChangeLog
gtk/gtkfilesystemmodel.c

index fa1fac3a18e66aef665504b9e3f6eeb65ad59610..f69c7dc79e233e9ff4815aef017aa4597723b458 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-05-01  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkfilesystemmodel.c (_gtk_file_system_model_path_do):
+       Don't ignore the fact that gtk_file_system_get_parent() 
+       may return NULL.  (#424042, Jan Martinek)
+
 2007-05-01  Dan Winship  <danw@novell.com>
 
        * gdk/x11/gdkwindow-x11.c (setup_toplevel_window): Make sure the
index 4398883712008992419ebcec964738571fad8fa0..f6be38fc11243743df2be63282f43a6d1316dbdb 100644 (file)
@@ -1134,7 +1134,7 @@ out:
  * @user_data: data to pass to @func
  * 
  * Locates @path within @model, referencing
- * (gtk_tree_model_ref_node ()) all parent nodes,
+ * (gtk_tree_model_ref_node()) all parent nodes,
  * calls @func passing in the path and iter for @path,
  * then unrefs all the parent nodes.
  *
@@ -1146,10 +1146,7 @@ out:
  *
  * This function is particularly useful for expanding
  * a #GtkTreeView to a particular point in the file system.
- * 
- * Return value: %TRUE if the path was successfully
- *  found in @model and @func was called.
- **/
+ */
 void
 _gtk_file_system_model_path_do (GtkFileSystemModel        *model,
                                const GtkFilePath         *path,
@@ -1161,15 +1158,17 @@ _gtk_file_system_model_path_do (GtkFileSystemModel        *model,
   FileModelNode *node;
   struct RefPathData *info;
 
-  if (gtk_file_path_compare (path, model->root_path) == 0
-      || !gtk_file_system_get_parent (model->file_system, path, &parent_path, NULL))
+  if (gtk_file_path_compare (path, model->root_path) == 0 ||
+      !gtk_file_system_get_parent (model->file_system, path, &parent_path, NULL) ||
+      parent_path == NULL)
     return;
 
   paths = g_slist_prepend (paths, gtk_file_path_copy (path));
   while (gtk_file_path_compare (parent_path, model->root_path) != 0)
     {
       paths = g_slist_prepend (paths, parent_path);
-      if (!gtk_file_system_get_parent (model->file_system, parent_path, &parent_path, NULL))
+      if (!gtk_file_system_get_parent (model->file_system, parent_path, &parent_path, NULL) || 
+          parent_path == NULL)
         {
          gtk_file_paths_free (paths);
          return;